import {
TOKEN,
LOGINBOX,
CLOSELOGINBOX,
LOGIN,
LOGINTO,
CLOSELOGIN,
HEADERH,
CARTOPEN,
CARTCLOSE,
HEADEROUT,
ISLOADING,
WAPNAV,
WAPCART
} from './mutation-types.js'

export default {

	//获取token
	tokensync({dispatch,commit},value){
		return commit(TOKEN,value);
	},
	//弹出登录窗
	loginBox({dispatch,commit}){
		return commit(LOGINBOX);
	},
	//关闭登录窗
	closeloginBox({dispatch,commit}){
		return commit(CLOSELOGINBOX);
	},
	//登陆
	loginsync({dispatch,commit},value){
		return commit(LOGIN,value);
	},
	//重新登录
	loginsyncTo({dispatch,commit}){
		return commit(LOGINTO);
	},
	//首页搜索框
	headerH({dispatch,commit},value){
		return commit(HEADERH,value);
	},
	//用户优惠卷
	closelogin({dispatch,commit}){
		return commit(CLOSELOGIN);
	},
	//开打购物车
	cartOpen({dispatch,commit}){
		return commit(CARTOPEN);
	},
	//关闭购物车
	cartClose({dispatch,commit}){
		return commit(CARTCLOSE);
	},
	//关闭购物车
	headerOut({dispatch,commit}){
		return commit(HEADEROUT);
	},
	//加载中
	isLoading({dispatch,commit},value){
		return commit(ISLOADING,value);
	},
	//网站导航栏目
	wapNav({dispatch,commit},value){
		return commit(WAPNAV,value);
	},
	//购物车信息
	wapCart({dispatch,commit},value){
		return commit(WAPCART,value);
	},
	trimStr(str){
	  return str.replace(/(^\s*)|(\s*$)/g,"")
	}
}


